package br.leiam.eolica.util;

import java.util.Date;
import java.util.Random;
import java.util.StringTokenizer;

public class Util {
	
	public static String getSaudacao(){		
		Date data = new Date();
		long now = data.getHours();
		if(now > 00 && now < 12){
			return "Bom Dia";
		}else if(now > 12 && now < 18){
			return "Boa Tarde";			
		}
		return "Boa Noite";
	}
	
	private static String timestamp() {
		Data data = new Data();
		return "["+data.getDia() +""+data.getMes()+ ""+data.getAno()+ "_"+data.getHorarioCompleto()+"]";
	}
	
	public static String capitular(String string) {
		StringTokenizer tokenizer = new StringTokenizer(string);
		String unidade = "";
		while(tokenizer.hasMoreTokens()){
			String aux = tokenizer.nextToken(); 
			aux = aux.toLowerCase();
			aux = aux.substring(0, 1).toUpperCase()+ aux.substring(1, aux.length());
			unidade += aux + " ";
		}
		return unidade.trim();
	}
	
	public static void threadSleep(){
		try {
			Thread.sleep(new Random().nextInt(7)*1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}

}
